Skip to content

fix(kimaki): make dm-context-filter strip-only#119

Merged
chubes4 merged 1 commit intomainfrom
remove-context-filter-appendix
May 4, 2026
Merged

fix(kimaki): make dm-context-filter strip-only#119
chubes4 merged 1 commit intomainfrom
remove-context-filter-appendix

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented May 4, 2026

Summary

The dm-context-filter plugin was appending two Data Machine-specific sections to every system prompt:

  • ## WordPress Site Runtime
  • ## Data Machine Session Handoff

That is bridge-specific positive guidance, and pre-injecting it via the runtime filter recreates the exact problem the filter exists to solve: runtime-bridge concerns leaking into the generic agent context.

This PR makes the plugin strip-only. Positive guidance about how to use the Kimaki bridge or the WordPress site runtime belongs in Data Machine's instruction stack (AGENTS.md, SOUL.md, SITE.md), not pre-injected by the bridge filter.

Why

The whole point of dm-context-filter is to keep bridge-specific guidance out of the agent's prompt — Kimaki worktree/cross-project sections, scheduling, dev-server, critique, etc. Adding our own bridge-specific appendix on the way out contradicted that. AGENTS.md (generated by Data Machine Code) and the rest of the instruction stack are the right home for any guidance the agent needs about how to use the bridge — they're discoverable, editable, and live with other agent guidance.

Changes

  • bridges/kimaki/plugins/dm-context-filter.ts: Remove appendWordPressSiteRuntimeInstruction() and appendDataMachineSessionHandoffInstruction() functions and their call sites. Update file header docstring to document the strip-only contract.
  • tests/effective-prompt/run.mjs: Drop "## Data Machine Session Handoff" from DEFAULT_ALLOW_LEAK_SECTIONS. The filter no longer appends that section, so no leak exemption is needed. Any trigger word in filtered output is now a real leak.
  • tests/effective-prompt/__snapshots__/: Refresh default.filtered.txt and no-agents-no-thread.filtered.txt.

Net effect

  • Filter strips strictly more (~6,070 tokens vs ~5,012 in the broken baseline)
  • 0 trigger leaks in filtered output for both test scenarios
  • 91 lines removed, 10 lines added

Test

$ node tests/effective-prompt/run.mjs

scenario: default
  raw      : 33,132 chars
  filtered :  8,852 chars (stripped 24,280, ~6070 tokens)
  baseline leaks: 11
  filtered leaks: 0
  PASS

scenario: no-agents-no-thread
  raw      : 32,685 chars
  filtered :  8,622 chars (stripped 24,063, ~6016 tokens)
  baseline leaks: 11
  filtered leaks: 0
  PASS

OK — 2 scenario(s) passed

AI assistance

  • AI assistance: Yes
  • Tool(s): Claude Code (claude-opus-4-7)
  • Used for: drafted the change after Chris identified the architectural boundary (plugin = strip-only; positive guidance lives in instruction files). Human reviewed every edit and ran the test suite locally before commit.

The plugin was appending two Data Machine-specific sections ("## WordPress
Site Runtime" and "## Data Machine Session Handoff") to every system
prompt. That is bridge-specific positive guidance and recreates the same
problem the filter exists to solve: runtime-bridge concerns leaking into
the generic agent context.

Positive guidance about how to use the Kimaki bridge or the WordPress
site runtime belongs in Data Machine's instruction stack (AGENTS.md,
SOUL.md, SITE.md, etc.), not pre-injected by the runtime filter.

Changes:
- Remove appendWordPressSiteRuntimeInstruction() and call site.
- Remove appendDataMachineSessionHandoffInstruction() and call site.
- Update file header docstring to reflect strip-only contract.
- Drop "## Data Machine Session Handoff" from
  DEFAULT_ALLOW_LEAK_SECTIONS in tests/effective-prompt/run.mjs since
  the filter no longer appends it (no leak exemption needed).
- Refresh effective-prompt snapshots.

Test: tests/effective-prompt passes both scenarios with 0 filtered
leaks (down from 11 baseline leaks). Filter now strips ~6,070 tokens
per session, ~1,058 more than the broken baseline.

AI assistance: Yes
Tool(s): Claude Code (claude-opus-4-7)
Used for: drafted the change after Chris identified the architectural
boundary (plugin = strip-only; positive guidance lives in instruction
files). Human reviewed every edit and ran the test suite.
@chubes4 chubes4 merged commit 2ec41c7 into main May 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant